
package com.insigma.business.qrcode.common.converter;



import com.insigma.business.qrcode.soldier.dto.PlacementSoldierAspirationBSearcher;
import com.insigma.business.qrcode.soldier.dto.PlacementSoldierAspirationDTO;
import com.insigma.business.qrcode.soldier.entity.PlacementSoldierAspirationDO;
import com.insigma.business.qrcode.soldier.request.PlacementSoldierAspirationInsertRequest;
import com.insigma.business.qrcode.soldier.request.PlacementSoldierAspirationSearchRequest;
import com.insigma.business.qrcode.soldier.request.PlacementSoldierAspirationUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class PlacementSoldierAspirationProviderConverter extends AbstractConverter<PlacementSoldierAspirationDTO, PlacementSoldierAspirationDO> {

    private final static PlacementSoldierAspirationProviderConverter placementSoldierAspirationConverter = new PlacementSoldierAspirationProviderConverter();

    private PlacementSoldierAspirationProviderConverter(){}

    
    public static PlacementSoldierAspirationBSearcher convertRequestSO2Searcher(final PlacementSoldierAspirationSearchRequest request){
        final PlacementSoldierAspirationBSearcher placementSoldierAspirationBSearcher = new PlacementSoldierAspirationBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,placementSoldierAspirationBSearcher);
        return placementSoldierAspirationBSearcher;
    }

    
    public static PlacementSoldierAspirationDO convertRequestUO2DO(final PlacementSoldierAspirationUpdateRequest placementSoldierAspirationUpdateRequest) {
        final PlacementSoldierAspirationDO placementSoldierAspirationDO = new PlacementSoldierAspirationDO();
        BeanUtils.copyProperties(placementSoldierAspirationUpdateRequest,placementSoldierAspirationDO);
        
        return placementSoldierAspirationDO;
    }

    
    public static PlacementSoldierAspirationDO convertRequestIO2DO(final PlacementSoldierAspirationInsertRequest placementSoldierAspirationInsertRequest) {
        final PlacementSoldierAspirationDO placementSoldierAspirationDO = new PlacementSoldierAspirationDO();
        BeanUtils.copyProperties(placementSoldierAspirationInsertRequest,placementSoldierAspirationDO);
        return placementSoldierAspirationDO;
    }

    
    public static List<PlacementSoldierAspirationDTO> convertResponseDOList2DTOList(final List<PlacementSoldierAspirationDO> placementSoldierAspirationDOList){
        return placementSoldierAspirationConverter.convertGenericResponseDOList2DTOList(placementSoldierAspirationDOList);
    }

    
    public static PlacementSoldierAspirationDTO convertResponseDO2DTO(final PlacementSoldierAspirationDO placementSoldierAspirationDO){
        return placementSoldierAspirationConverter.convertGenericResponseDO2DTO(placementSoldierAspirationDO);
    }

    
    @Override
    protected PlacementSoldierAspirationDTO doConvertResponseDO2DTO(PlacementSoldierAspirationDO placementSoldierAspirationDO) {
        final PlacementSoldierAspirationDTO placementSoldierAspirationDTO = new PlacementSoldierAspirationDTO();
        try {
            BeanUtils.copyProperties(placementSoldierAspirationDO, placementSoldierAspirationDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return placementSoldierAspirationDTO;
    }

}
